package day5.day5_2;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class WaterMargin {
    public static void main(String[] args) throws Exception {
        Scanner in=new Scanner(System.in);
        System.out.print("输入好汉的姓名:");
        String x=in.next();
        InputStreamReader isr = new InputStreamReader(new FileInputStream("C:\\Users\\董\\Documents\\Tencent Files\\2777388365\\FileRecv\\水浒传.txt"),"GBk");
        char[] ar=new char[isr.read()];
        int length;
        String s=null;
        while ((length= isr.read(ar))!=-1){
            s = new String(ar, 0, length);
//            System.out.println(s);
        }
        System.out.println(s.substring(s.indexOf(x)-10,s.indexOf(x)+3));
    }
}
